import turtle

# 设置画布和画笔
wn = turtle.Screen()
wn.bgcolor("black")
wn.title("Snowflake")

pen = turtle.Turtle()
pen.speed(0)
pen.color("white")


# 画雪花形状
def snowflake(size):
    if size <= 10:
        pen.forward(size)
        return
    else:
        snowflake(size / 3)
        pen.left(60)
        snowflake(size / 3)
        pen.right(120)
        snowflake(size / 3)
        pen.left(60)
        snowflake(size / 3)


# 画三个不同大小的雪花
pen.penup()
pen.goto(-200, 0)
pen.pendown()
snowflake(300)

pen.penup()
pen.goto(0, 0)
pen.pendown()
snowflake(200)

pen.penup()
pen.goto(200, 0)
pen.pendown()
snowflake(100)

# 关闭画布
wn.exitonclick()